/**
 * 初始化
 */
function init() {
	var selectedLanmuNode;

	var viewport = new Ext.Viewport({
		layout : 'border',
		items : [new Ext.tree.TreePanel({
					region : 'west',
					id : 'treePanel',
					title : '<font style="font-size:13px;">资产分类</font>',
					split : false,
					width : 200,
					collapsible : false,
					layout : 'fit',
					layoutConfig : {
						animate : true
					},
					checkModel : 'single',
					margins : '0 3 0 0',
					// onlyLeafCheckable : true,
					autoScroll : true,
					animate : true,
					rootVisible : true,
					loader : new Ext.tree.TreeLoader({
								dataUrl : context
										+ '/system/ddindexshow.do?method=tree',
								baseParams : {

					}
							}),
					root : new Ext.tree.AsyncTreeNode({
								allowChildren : true,
								expanded : true,
								text : nodeName, // 节点名称
								draggable : false, // 是否支持拖动
								iconCls : 'root',
								cls : 'rootFont',
								id : nodeId
							}),
					listeners : {
						'click' : function(node) {
							/*
							 * if (node.isExpanded()) { node.collapse(); } else {
							 * node.expand(); }
							 */

							designTemplate(node);
						},
						'checkchange' : function(node, checked) {
							if (checked) {
								if (selectedLanmuNode) {
									selectedLanmuNode.attributes.checked = false;
									selectedLanmuNode.ui.checkbox.checked = false;
								}

								selectedLanmuNode = node;
							}
						}
					}
				}), {
			id : 'tmpwin',
			region : 'center',
			layout : 'fit',
			autoScroll : true,
			title : '<font style="font-size:13px;">资产模板定义</font>',
			html : '<iframe id="frm" width="100%" height="100%" frameborder="0" src="'
					+ context + '/system/blank.jsp"></iframe>'
		}]
	});

	Ext.getCmp('treePanel').getRootNode().expand(true);
}

/**
 * 新建内容信息
 * 
 * @param {}
 *            id
 */
function designTemplate(node) {
	if (node.id != '0') {
		var url = context + '/system/tablequery/jsplist.jsp?queryKey=gdzctemplist&typeId=' + node.id;

		if (Ext.get('frm')) {
			Ext.getCmp('tmpwin').setTitle('<font style="font-size:13px;">' + node.text + '_模板定义</font>');
			Ext.get('frm').dom.src = url;
		}
	}
}